package zestaw4.klonowanie_obiektow_2;

/**
 * Author: Daniel
 * Date: 03.08.13
 */

public class E {
    private final int[] arr = {1, 2, 3};

    public E() {}

    public static E getInstance(E orgObj) {
        // nowy obiekt
        E newInst = new E();
        System.arraycopy(orgObj.arr, 0, newInst.arr, 0, orgObj.arr.length);
        return newInst;
    }

    public E(E orgObj) {
        for (int i = 0; i < orgObj.arr.length; i++) {
            arr[i] = orgObj.arr[i];
        }
    }

    public int[] getArr() {
        return arr;
    }

    public void set(int i, int val) {
        arr[i] = val;
    }
}
